<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/include.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>JavaScript Demo</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link />
	<style type="text/css">
		#container{
		    width: 760px;
		    height: 600px;
		    margin: 30px auto;
		    /* IE fix 居中布局 */
		    text-align: center;
		}
		 
		#main{
		    width: 760px;
		    height: 600px;
		    margin: 30px auto;
		    /* IE fix 居中布局 */
		 	text-align: left;
		}
	</style>
	
	<script type="text/javascript">
		/*
			Javascript 中的 var
			http://coolshell.cn/articles/7480.html
		*/
		
		var newLine = "<br/>";	

		// These are both globals
		var foo = 1;
		bar = 2;
		 
		function test() {
		    var foo = 1; // Local
		    bar = 2;     // Global
		 
		    // Execute an anonymous function
		    (function()
		    {
		        var wibble = 1; // Local
		        foo = 2; // Inherits from scope above (creating a closure)
		        moo = 3; // Global
		    }());
		}
		/* 
		如果你不用var，那么这个js引擎会一层一层地向上找父作用域中的变量，
		如果找到了，就用，如果找不到了，就会帮你定义一个全局的变量
		*/
	</script>
</head>

<body>
	<div id="container">
		<div id="main">
				
		</div>
	</div>
</body>
</html>
